#!/bin/sh
dir="Data/album/*"
for folder in $dir;do
    echo $folder
    for file in $folder/*;do
	base=${file%%.*}
	ext=${file##*.}
	# echo $base
	# echo $ext
	thumb="${base}.thumb.${ext}"
	if [ ! -f $thumb ]; then
	    convert -resize x160 $file $thumb
	    echo "convert -resize x160 $file $thumb"
	fi
    done
done

# update album set thumb = concat(substring_index(photo,".",1),".thumb.", substring_index(photo,".", -1)) where photo != '';

